﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Zwms.Client.CommonUI;
using Zwms.Data.BusinessObjects;

namespace Zwms.Client.InWms
{
    public partial class IPBillDetailInputForm : BaseForm
    {
        private BilInPlanBill _iPBill = null;
        private List<BilInPlanBillDetail> _iPBillDetailList = null;
        public IPBillDetailInputForm(BilInPlanBill ipBill, List<BilInPlanBillDetail> iPBillDetailList)
        {
            InitializeComponent();
            _iPBill = ipBill;
            _iPBillDetailList = iPBillDetailList;
            InitBtnImage();
            InitControl();
        }

        #region 私有函数
        private void InitBtnImage()
        {
            this.btnConfirm.Image = global::Zwms.Client.Properties.Resources.ok;
            this.btnCancel.Image = global::Zwms.Client.Properties.Resources.cancel;
        }

        private void InitControl()
        {
            tbIpBillCode.Text = _iPBill.Id;
            tbWarehouseName.Text = _iPBill.WarehouseName;

            this.bilInPlanBillDetailBindingSource.DataSource = null;
            if (_iPBillDetailList.Count > 0)
            {
                this.bilInPlanBillDetailBindingSource.DataSource = _iPBillDetailList;
            }
        }
        #endregion

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }
    }
}
